\(\int \cos ^2(a+b x) \cot (a+b x) \, dx\) [123]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 27 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {\log (\sin (a+b x))}{b}-\frac {\sin ^2(a+b x)}{2 b} \]

[Out]

ln(sin(b*x+a))/b-1/2*sin(b*x+a)^2/b

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {2670, 14} \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {\log (\sin (a+b x))}{b}-\frac {\sin ^2(a+b x)}{2 b} \]

[In]

Int[Cos[a + b*x]^2*Cot[a + b*x],x]

[Out]

Log[Sin[a + b*x]]/b - Sin[a + b*x]^2/(2*b)

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {1-x^2}{x} \, dx,x,-\sin (a+b x)\right )}{b} \\ & = \frac {\text {Subst}\left (\int \left (\frac {1}{x}-x\right ) \, dx,x,-\sin (a+b x)\right )}{b} \\ & = \frac {\log (\sin (a+b x))}{b}-\frac {\sin ^2(a+b x)}{2 b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {\log (\sin (a+b x))}{b}-\frac {\sin ^2(a+b x)}{2 b} \]

[In]

Integrate[Cos[a + b*x]^2*Cot[a + b*x],x]

[Out]

Log[Sin[a + b*x]]/b - Sin[a + b*x]^2/(2*b)

Maple [A] (verified)

Time = 0.08 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.85

method result size
derivativedivides \(\frac {\frac {\left (\cos ^{2}\left (b x +a \right )\right )}{2}+\ln \left (\sin \left (b x +a \right )\right )}{b}\) \(23\)
default \(\frac {\frac {\left (\cos ^{2}\left (b x +a \right )\right )}{2}+\ln \left (\sin \left (b x +a \right )\right )}{b}\) \(23\)
parallelrisch \(\frac {4 \ln \left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )\right )-4 \ln \left (\sec ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )-1+\cos \left (2 b x +2 a \right )}{4 b}\) \(43\)
risch \(-i x +\frac {{\mathrm e}^{2 i \left (b x +a \right )}}{8 b}+\frac {{\mathrm e}^{-2 i \left (b x +a \right )}}{8 b}-\frac {2 i a}{b}+\frac {\ln \left ({\mathrm e}^{2 i \left (b x +a \right )}-1\right )}{b}\) \(57\)
norman \(-\frac {2 \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )^{2}}+\frac {\ln \left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}-\frac {\ln \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}\) \(66\)

[In]

int(cos(b*x+a)^3/sin(b*x+a),x,method=_RETURNVERBOSE)

[Out]

1/b*(1/2*cos(b*x+a)^2+ln(sin(b*x+a)))

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.93 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {\cos \left (b x + a\right )^{2} + 2 \, \log \left (\frac {1}{2} \, \sin \left (b x + a\right )\right )}{2 \, b} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a),x, algorithm="fricas")

[Out]

1/2*(cos(b*x + a)^2 + 2*log(1/2*sin(b*x + a)))/b

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 369 vs. \(2 (20) = 40\).

Time = 0.61 (sec) , antiderivative size = 369, normalized size of antiderivative = 13.67 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\begin {cases} - \frac {\log {\left (\tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 1 \right )} \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} - \frac {2 \log {\left (\tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} - \frac {\log {\left (\tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 1 \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {a}{2} + \frac {b x}{2} \right )} \right )} \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} + \frac {2 \log {\left (\tan {\left (\frac {a}{2} + \frac {b x}{2} \right )} \right )} \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {a}{2} + \frac {b x}{2} \right )} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} - \frac {2 \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )}}{b \tan ^{4}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + 2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b x}{2} \right )} + b} & \text {for}\: b \neq 0 \\\frac {x \cos ^{3}{\left (a \right )}}{\sin {\left (a \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(b*x+a)**3/sin(b*x+a),x)

[Out]

Piecewise((-log(tan(a/2 + b*x/2)**2 + 1)*tan(a/2 + b*x/2)**4/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2
+ b) - 2*log(tan(a/2 + b*x/2)**2 + 1)*tan(a/2 + b*x/2)**2/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2 + b
) - log(tan(a/2 + b*x/2)**2 + 1)/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2 + b) + log(tan(a/2 + b*x/2))
*tan(a/2 + b*x/2)**4/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2 + b) + 2*log(tan(a/2 + b*x/2))*tan(a/2 +
 b*x/2)**2/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2 + b) + log(tan(a/2 + b*x/2))/(b*tan(a/2 + b*x/2)**
4 + 2*b*tan(a/2 + b*x/2)**2 + b) - 2*tan(a/2 + b*x/2)**2/(b*tan(a/2 + b*x/2)**4 + 2*b*tan(a/2 + b*x/2)**2 + b)
, Ne(b, 0)), (x*cos(a)**3/sin(a), True))

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.93 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=-\frac {\sin \left (b x + a\right )^{2} - \log \left (\sin \left (b x + a\right )^{2}\right )}{2 \, b} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a),x, algorithm="maxima")

[Out]

-1/2*(sin(b*x + a)^2 - log(sin(b*x + a)^2))/b

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.93 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=-\frac {\sin \left (b x + a\right )^{2} - \log \left (\sin \left (b x + a\right )^{2}\right )}{2 \, b} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a),x, algorithm="giac")

[Out]

-1/2*(sin(b*x + a)^2 - log(sin(b*x + a)^2))/b

Mupad [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.30 \[ \int \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {\frac {{\cos \left (a+b\,x\right )}^2}{2}-\frac {\ln \left ({\mathrm {tan}\left (a+b\,x\right )}^2+1\right )}{2}+\ln \left (\mathrm {tan}\left (a+b\,x\right )\right )}{b} \]

[In]

int(cos(a + b*x)^3/sin(a + b*x),x)

[Out]

(log(tan(a + b*x)) - log(tan(a + b*x)^2 + 1)/2 + cos(a + b*x)^2/2)/b